package Demo;

import java.util.Scanner;

public class Demo12 {
    public static void main(String[] args) {
        //键盘输入案例1 比较大小

        Scanner s = new Scanner(System.in);
        System.out.print("请输入第一个整数：");
        int num1 = s.nextInt();
        System.out.print("请输入第二个整数：");
        int num2 = s.nextInt();

        System.out.println("较大数为：" + (num1 > num2? num1:num2));

        //键盘输入案例2  数据交换
        System.out.print("请输入第一个数：");
        String line1 = s.next();
        System.out.print("请输入第二个数：");
        String line2 = s.next();
        //数据交换
        String str = "";
        str = line1;
        line1 = line2;
        line2 = str;

        System.out.println(line1);
        System.out.println(line2);
    }
}
